Postgresql Docker Setup
Install Docker
- Linux
- Windows
- Mac
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
Log out and back in, then verify:
docker --version
- Download Docker Desktop for Windows
https://www.docker.com/products/docker-desktop/ - Install and enable WSL 2 when prompted, or manually install it:
- Right-click PowerShell and select Run as administrator
- Run:
wsl --install - Restart your machine after installation
For more details, see the official guide:
How to install Linux on Windows with WSL
- Restart and verify:
docker --version
注意
Docker Desktop on Windows requires hardware virtualization to be enabled. It runs Linux containers inside a lightweight virtual machine (VM) that uses either Hyper-V (or the underlying Windows Hypervisor Platform) or the Windows Subsystem for Linux 2 (WSL 2), both of which depend on your CPU's hardware virtualization capabilities (Intel VT-x or AMD-V) being enabled in the BIOS/UEFI settings.
Solution
- Since windows home has no Hyper-v support it can't use vitualization, hence can't use docker. You can use (MAS tool)[https://massgrave.dev/] to change the version of your windows to include the feature.
- (Enable Virtualization on Windows)[https://support.microsoft.com/en-us/windows/enable-virtualization-on-windows-c5578302-6e43-4b4b-a449-8ced115f58e1]
- Download Docker Desktop for Mac
https://www.docker.com/products/docker-desktop/ - Install and launch Docker Desktop
- Verify:
docker --version